# Bantil Io`Tuv - Magician Epic 1.5: Pre-Quest 
# location Plane of Knowledge 993 114 95
# Appearance: http://eqbeastiary.allakhazam.com/search.shtml?id=16460
# Provocating - Dragons of Mist

sub EVENT_SAY {
  if($text=~/hail/i) {
    quest::say("Greetings. I am looking for someone who has followed in the footsteps of Magi'Kot, but you do not seem to have progressed that far. There is [another way] for you to prove your control of the elements to me.");
  }   
  if($text=~/another/i) {
    quest::say("Well, there are 4 Elementals that have gone rogue. They escaped from their elemental planes, and I fear they may be planning some mischief. They have assumed new names, so look for a Wildfire Elemental, an Earthquake Elemental, a Tsunami Elemental, and a Monsoon Elemental. Hand them this vial when you find them, it will allow you to fight them, and also capture them once they are beaten. Return them to me so they can be handled correctly.");
    quest::summonitem(11304);
  }
  if($text=~/power/i) {
    quest::say("They use the elements in a way we have yet to understand. I suspect something in their essence that allows them to tap into the elements in a different manner than we understand. If my suspicions are true, these creatures should leave behind a small portion of their essence, when their spirits leave their bodies. If you find anything like that, bring it to me. They may be rather small, so bring me two from each type for good measure.");
  }
  # Check for Pre Quest Conditions here, Return all four essences to him in order to complete the pre-quest. 
  if($text=~/power/i) {
    quest::say("Greetings. I see you have followed the path of Magi'Kot, quite some time ago he was my teacher. I was sad to hear of his fate. He was a great man, he understood the elements in a manner that few have before him. I was glad to hear that his legacy lived past his demise, and I am happy to meet someone that has followed in his [footsteps].");
  }
  if($text=~/footsteps/i) {
    quest::say("Magi'Kot strove to push the limits of knowledge, however few know that he was more of a researcher than an innovator. His strongest attribute was the ability to gather knowledge and derive patterns and trends from the teachings of summoners before him. Since his untimely death, I have learned the [source of his research] on elemental mastery.");
  }
  if($text=~/source of his research/i) {
    quest::say("There have been elemental masters for as long as there has been magic. There are many great magicians whose names have been lost to history. I recently learned that Magi'Kot gained access to some of these ancient teachings. This is how he learned the path to elemental mastery. His other disciples and myself thought this knowledge was gone forever, until we learned that the original tomes were stored here, in the [Great Library].");
  }
  if($text=~/great library/i) {
    quest::say("There is little that has ever been written that has not, or will not, sit on the shelves here. Sadly, when I finally managed to make it here, the tomes were missing. No one seemed to know where they have gone or why. I have been searching for clues telling of where these tomes vanished to, and finally, the [pieces] are starting to come together.");
  }
  if($text=~/what pieces/i) {
    quest::say("I am hesitant to use the word conspiracy, however the more I find, the more that seems to be the best choice. I found this note while searching for the tomes. I suspect it may lead you to finding the first of the missing tomes, sadly I do not recognize the language.");
    quest::summonitem(15005); # Tattered Note
  }
}
 
sub EVENT_ITEM
{
  if(plugin::check_handin(\%itemcount, 15639  => 1)) { # Journal of Magus Tvish
    quest::emote("focuses for a minute, his hands glow with power. He then blows softly and the shadows melt from the Tome. As he opens it a small note falls to the floor. What is this? it appears to be some sort of correspondence. Hmm, interesting, it seems the next tome was given to a gnome, he set sail somewhere, but has not been heard from in quite some time. You will have to find him, he was supposed to wait for [Danvi] so he could take the tome.");
  }
  if($text=~/danvi/i) {
    quest::emote("Danvi is supposed to identify herself with the password \"Violet Roses\", when you find this gnome tell him the pass phrase and he should give you the book.");
  } 
  
  if(plugin::check_handin(\%itemcount, 15769  => 1)) { # Tome of Primal Fires
    quest::emote("quickly thumbs through the book. You can see the excitement growing on his face. 'This is incredible. I can see why Magi'Kot was able to learn so much from these tomes. There are just three more that we need to find, and we will be able to [ascend beyond] Magi'Kot's greatest dreams.");
  }
}